﻿using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace ALEXBlog.IRepository.Redis
{
    public interface IRedisRepository
    {
        Task ClearAsync();
        Task<bool> ExistAsync(string key);
        Task<string> GetAsync(string key);
        Task<TEntity> GetAsync<TEntity>(string key);
        IServer GetServer();
        IDatabase GetDatabase();
        Task ListClearAsync(string key);
        Task<long> ListFirstPushAsync<TEntity>(string redisKey, params TEntity[] redisValue);
        Task<string> ListFirstRemoveAsync(string key);
        Task<TEntity> ListFirstRemoveAsync<TEntity>(string key);
        Task<IEnumerable<TEntity>> ListGetAsync<TEntity>(string key);
        Task<long> ListLastPushAsync<TEntity>(string redisKey, params TEntity[] redisValue);
        Task<string> ListLastRemoveAsync(string key);
        Task<TEntity> ListLastRemoveAsync<TEntity>(string key);
        Task<long> ListLengthAsync(string key);
        Task<IEnumerable<string>> ListRangeGetAsync(string key);
        Task<IEnumerable<string>> ListRangeGetAsync(string key, int startIndex, int stopIndex);
        Task<IEnumerable<TEntity>> ListRangeGetAsync<TEntity>(string key, int startIndex, int stopIndex);
        Task<long> ListRangeRemoveAsync(string key, string value, long type = 0);
        Task<bool> RemoveAsync(string key);
        Task<bool> SetAsync(string key, string value, TimeSpan cacheTime);
        Task<bool> SetAsync<TEntity>(string key, TEntity value, TimeSpan cacheTime);
        Task<bool> SetAsync(string key, string value);
        Task<long> RemoveAsync(params string[] keys);
    }
}
